package ldkxingzhe.ldkxingzhedemo.view.dialogs;

import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.widget.DatePicker;
import android.widget.TimePicker;

import java.util.Calendar;

import ldkxingzhe.ldkxingzhedemo.utils.LogDemo;


/**
 * Created by xingzhe on 15/10/8.
 */
public class TimePickerDialogFragments extends DialogFragment implements TimePickerDialog.OnTimeSetListener, DatePickerDialog.OnDateSetListener {

    final static String TAG = TimePickerDialogFragments.class.getSimpleName();

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle("Test For DialogFragment");
        builder.setMessage("Hope everything fine");
        builder.setCancelable(true);
        builder.setNegativeButton("确认",null);

        Dialog dialog = new TimePickerDialog(getActivity(),this,Calendar.HOUR_OF_DAY, Calendar.MINUTE, true);
        Calendar calendar = Calendar.getInstance();
//        Dialog dialog = new DatePickerDialog(getActivity(), this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
        return dialog;
    }

    @Override
    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
        LogDemo.v(TAG,"onTimeSet");
    }

    @Override
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
        LogDemo.v(TAG,"onDateSet");
    }
}
